<?php
 include "template/header.php";
 include "css/table.php";
	echo "<h1>Fale Conosco</h1>";
	if(isset($_SESSION['tipo_usuario'])){
						
	$id = $_SESSION['tipo_usuario'];
	if($id == 6){
	if($con){
		$sql = 'select * from faleconosco where status like "Respondido" order by data desc';
		$rs = mysql_query($sql, $con);
		$atual = date("Y-m-d");
		
		if($rs){	
			
			while($vetor = mysql_fetch_array($rs)){
			$enviado = $vetor['data'];
			$diferenca = strtotime($atual) - strtotime($enviado);
			
			$dias = floor($diferenca / (60 * 60 * 24));
			
			$valor = $vetor['data'];
			$data = substr($valor, 8, 10).'/';
			$data2 = substr($vetor['data'], 5, 2);
			$data1 = "/".substr($valor, 0,4);
			$fdata = $data.$data2.$data1;
			?>
			<table >
				<tr>
				<td width="3" id="estilo">ID:</td>
				<td width="3"><?php echo $vetor['id']; ?></td>
				<td width="10" id="estilo">Nome:</td>
				<td colspan="3"> <?php echo $vetor['nome']; ?></td>	
				</tr>
				<tr>
				
				<td id="estilo">Data:</td>
				<td><?php echo $fdata; ?></td>	
				<td width="10" id="estilo">E-mail</td>
				<td colspan="3"><?php echo $vetor['email']; ?></td>				
				</tr>
				<tr>
				<td id="estilo">Numero de dias:</td>
				<td><?php echo $dias; ?></td>
				<td width="3" id="estilo">Status</td>
				<td><?php echo $vetor['status']; ?></td>
				<td><center><img height='50px' src='botoes/respondido.jpg'></center></td>
				</td>				
				</tr>
			</table>
			<br/>
			<?php
			}
			
			echo "<a href='menu_adm.php'><img height='50px' src='botoes/retroceder.jpg'><a/>";
		}
		
		else{
			echo "fail".mysql_error();
		}
	}
	else{
		echo 'falhou';
	
	}
	
 
	}
	else{
		echo "Acesso restrito";
	
	}
}
 
 
 
 
 
 
 include "template/footer.php";


?>